﻿using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Metadata.Util;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Core.Report.PlugIn;
using Kingdee.BOS.Core.Report.PlugIn.Args;
using Kingdee.BOS.Util;
using Kingdee.BOS.Web.Report.SQLReport;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RK.ReportPlugin.BPW
{
    [Description("BPW:SQL报表设置前景色"), HotUpdate]
    public class SetColor : AbstractSysReportPlugIn
    {
        public override void OnFormatRowConditions(ReportFormatConditionArgs args)
        {
            base.OnFormatRowConditions(args);
            //var obj = this.View.Model.DataObject;
            var dataRows = args.DataRow;
            var d1 = dataRows["客户可到货日期"];
            var d2 = dataRows["要货日期"];
            if (d1 != DBNull.Value && d2 != DBNull.Value)
            {
                if (Convert.ToDateTime(d1).ToString("d") != Convert.ToDateTime(d2).ToString("d"))
                {
                    FormatCondition FSOQTY_FC = new FormatCondition()
                    {
                        ForeColor = "#EE0000",
                        Key = "客户可到货日期"
                    };
                    args.FormatConditions.Add(FSOQTY_FC);
                }
            }
        }
    }
}
